<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
    <title>打字机动效按钮</title>
    <style>
        .app {
            width: 100%;
            height: 100vh;
            background-color: #ffffff;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .btn81 {
            --hover-text: 'HOVER';
            --b-color: #7ead63;
            padding: 032px;
            height: 56px;
            font-size: 18px;
            letter-spacing: 2px;
            color: var(--b-color);
            font-weight: bold;
            position: relative;
            background-color: transparent;
            border: 1px solid var(--b-color);
            outline: none;
            border-radius: 7px;
            cursor: pointer;
            overflow: hidden;
        }

        .btn81:before {
            content: '';
            width: 0;
            height: 100%;
            position: absolute;
            top: 0;
            left: 0;
            background-color: var(--b-color);
            transition: width 0.3s ease-in-out;
            z-index: 1;
            cursor: pointer;
        }

        .btn81:hover:before {
            width: 100%;
        }

        .btn81:after {
            content: var(--hover-text);
            width: 0;
            color: #ffffff;
            z-index: 10;
            position: absolute;
            left: 32px;
            transition: width 0.3s steps(5, end);
            overflow: hidden;
            box-sizing: border-box;
            z-index: 2;
            cursor: pointer;
        }

        .btn81:hover:after {
            width: calc(100%-64px);
            transition-delay: 0.4s;
        }

        .btn81:active {
            transform: scale(0.98);
        }
    </style>
</head>

<body>
    <div class="app">
        <button class="btn81">HOVER</button>
    </div>
</body>

</html>